package com.yuwj.chinaa.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.yuwj.chinaa.R;
import com.yuwj.chinaa.base.BaseActivity;
import com.yuwj.chinaa.base.ConstantParam;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TradeSuccessActivity extends BaseActivity {
    int currentTradeType = ConstantParam.TRANSACTION_TYPE_WITH_BUY;//当前交易类型，0-买入GTE，1-卖出GTE
    @BindView(R.id.iv_back)
    ImageButton ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_success_tip)
    TextView tvSuccessTip;
    @BindView(R.id.tv_see_my_order)
    TextView tvSeeMyOrder;


    public static Intent createIntent(Context context, int tradeType) {
        Intent intent = new Intent(context, TradeSuccessActivity.class);
        intent.putExtra("tradeType", tradeType);
        return intent;
    }

    @Override
    public int setCustomContentViewResourceId() {
        return R.layout.activity_trade_success;
    }

    @Override
    public void initParam() {
        currentTradeType = getIntent().getIntExtra("tradeType", ConstantParam.TRANSACTION_TYPE_WITH_BUY);
    }

    @Override
    public void initView() {
        switch (currentTradeType) {
            case ConstantParam.TRANSACTION_TYPE_WITH_BUY:
                tvTitle.setText("买入china-A");
                tvSuccessTip.setText("已挂单成功，等待卖家卖出");

                break;
            case ConstantParam.TRANSACTION_TYPE_WITH_SELL:
                tvTitle.setText("卖出china-A");
                tvSuccessTip.setText("已挂单成功，等待买家购买");
                break;
        }
    }

    @Override
    public void initOperator() {

    }

    @OnClick({R.id.iv_back, R.id.tv_see_my_order})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                onBackPressed();
                break;
            case R.id.tv_see_my_order:
                startActivity(OrderBaseListActivity.createIntent(context));
                finish();
                break;
        }
    }
}
